# Maintainer: Andrew Sun <adsun701@gmail.com>

_realname=libcue
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.2.1
pkgrel=1
pkgdesc="Parses so-called cue sheets and handles the parsed data (mingw-w64)"
arch=('any')
url="https://github.com/lipnitsk/libcue/"
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-gcc")
license=('GPL')
source=("${_realname}-${pkgver}.tar.gz::https://github.com/lipnitsk/libcue/archive/v${pkgver}.tar.gz")
sha256sums=('f27bc3ebb2e892cd9d32a7bee6d84576a60f955f29f748b9b487b173712f1200')

build() {
  cd "${srcdir}"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    ${MINGW_PREFIX}/bin/cmake \
      -G'MSYS Makefiles' \
      -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
      -DBUILD_SHARED_LIBS=ON \
      ../${_realname}-${pkgver}

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
}
